/* vim: set sw=8 ts=8 sts=8 expandtab: */
#ifndef CMAID_PRIVATE_H
#define CMAID_PRIVATE_H

#include <stdlib.h>
#include <string.h>
#include "config.h"

/*
 * Macro to shorten the interface assignment
 */
#define CMAID_CONTAINER_INTERFACE_SET(c, i) CMAID_CONTAINER(c)->interface = \
                        CMAID_CONTAINER_INTERFACE(i)

/*
 * Helper functions to create nodes (cmaid_nodes.h)
 */
void *cmaid_single_node_new(unsigned int node_size, const Cmaid_Value *v,
                const void *val, unsigned int val_size, void **ptr_val);
void *cmaid_single_node_free(void *node, const Cmaid_Value *v, void *val);
void *cmaid_pair_node_new(unsigned int node_size, 
                                const Cmaid_Value *key_info, const void *key,
                                unsigned int key_size, void **ptr_key,
                                const Cmaid_Value *val_info, const void *val,
                                unsigned int val_size, void **ptr_val);
void *cmaid_pair_node_renew(void *node, unsigned int node_size, 
                                unsigned int key_size,
                                const Cmaid_Value *val_info, const void *val, 
                                void **ptr_val);
void *cmaid_pair_node_free(void *node, const Cmaid_Value *key_info, void *key,
                                const Cmaid_Value *val_info, void *val);

/* Remove an iterator from the container iterator list */
void cmaid_iterlist_remove(Cmaid_Iter **iter_list, Cmaid_Iter *it);
void cmaid_iterlist_repair(Cmaid_Iter *iter_list, void *old_node, void *new_node);

#define RM_UPPERSTYLE
#if CMAID_ENABLE_DEBUG
# define MALLOC_DEBUG
#endif
#include "rmalloc.h"

#endif
